package net.sansi.v3correctserver.service.space;

import cn.hutool.extra.spring.SpringUtil;
import lombok.extern.slf4j.Slf4j;
import net.sansi.v3correctserver.util.SpaceUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.nio.file.Path;

/**
 * Created by Fang
 * create time : 2025/1/22
 * IDE : IntelliJ IDEA
 * <p>
 * 空间服务
 */

@Service
@Slf4j
public class SpaceService {

    @Value("${correct.server-space}")
    private String serverSpace;

    /**
     * 获取空间服务实例
     *
     * @return 空间服务实例
     */
    public static SpaceService getInstance() {
        return SpringUtil.getBean(SpaceService.class);
    }

    /**
     * 获取服务端空间路径
     *
     * @return 服务端空间路径
     */
    public Path getRootPath() {
        return Path.of(serverSpace);
    }

    public SpaceUtil getRootSpaceUtil() {
        return new SpaceUtil(getRootPath());
    }


}
